﻿using Aurora.AI.Abstractions;
using Aurora.AI.Abstractions.Chats;
using Aurora.AI.Abstractions.Embeddings;
using Aurora.AI.Abstractions.Images;
using Aurora.AI.Abstractions.Video;
using Aurora.AI.MetaGLM.Chats;
using Aurora.AI.MetaGLM.Embeddings;
using Aurora.AI.MetaGLM.Images;
using Aurora.AI.MetaGLM.Video;
using Microsoft.Extensions.DependencyInjection;

namespace Aurora.AI.MetaGLM.Extensions;

public static class MetaGLMServiceCollectionExtensions
{
    public static IServiceCollection AddMetaGLMService(this IServiceCollection services)
    {
        AuroraAIGlobal.PlatformNames.Add(MetaGLMPlatformOptions.PlatformName, MetaGLMPlatformOptions.PlatformCode);
        // 添加平台支持模型列表
        AuroraAIGlobal.ModelNames.Add(MetaGLMPlatformOptions.PlatformCode, [
            "glm-4-flash",
            "glm-4-long",
            "glm-4-airx",
            "glm-4-plus",
            "glm-4-0520",
            "glm-4",
            "glm-4-air",
            "glm-4v-plus",
            "glm-4v",
            "cogview-3-plus",
            "cogview-3",
            "cogvideox"
        ]);


        services.AddSingleton<MetaGLM.Modules.Images>();
        services.AddSingleton<MetaGLM.Modules.Videos>();
        services.AddKeyedSingleton<IAuroraAIChatCompletionsService, MetaGLMChatCompletionsService>(MetaGLMPlatformOptions.PlatformCode);
        services.AddKeyedSingleton<IAuroraAIImageService, MetaGLMImageService>(MetaGLMPlatformOptions.PlatformCode);
        services.AddKeyedSingleton<IAuroraVideoService, MetaGLMVideoService>(MetaGLMPlatformOptions.PlatformCode);
        services.AddKeyedSingleton<IAuroraAITextEmbeddingService, MetaGLMTextEmbeddingService>(MetaGLMPlatformOptions.PlatformCode);
        return services;
    }
}